<?php
namespace Admin\Controller;
use Think\Controller;

class PublicController extends Controller {
    
    /**
     * 后台登录
     * @return [type] [description]
     */
    public function login(){
    	if(IS_POST) {
    		$adminModel = D("Admin");
    		if($adminModel->create()) {
    			$this->success('登录成功', U('Index/index'));
    			exit;
    		} else {
    			$this->error($adminModel->getError());
    		}
    	}

        $this->display();
    }

    /**
     * 后台退出
     * @return [type] [description]
     */
    public function logout() {
        session('admin_uid', null);
        session('auth', null);

        redirect(U('Public/login'));
    }
}